home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / himetr1r / ctlbookm.ctl < prev    next >
Encoding:
Text File  |  1999-08-14  |  22.5 KB  |  725 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  3. Begin VB.UserControl ctlFavourites 
  4.    ClientHeight    =   2415
  5.    ClientLeft      =   0
  6.    ClientTop       =   0
  7.    ClientWidth     =   3165
  8.    BeginProperty Font 
  9.       Name            =   "Tahoma"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   400
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    ScaleHeight     =   2415
  18.    ScaleWidth      =   3165
  19.    Begin VB.PictureBox picTabContainer 
  20.       Height          =   1695
  21.       Index           =   3
  22.       Left            =   1080
  23.       ScaleHeight     =   1635
  24.       ScaleWidth      =   3315
  25.       TabIndex        =   7
  26.       Top             =   3480
  27.       Width           =   3375
  28.       Begin ComctlLib.ListView lvSort 
  29.          Height          =   855
  30.          Left            =   0
  31.          TabIndex        =   9
  32.          Top             =   360
  33.          Width           =   2895
  34.          _ExtentX        =   5106
  35.          _ExtentY        =   1508
  36.          View            =   3
  37.          LabelEdit       =   1
  38.          LabelWrap       =   -1  'True
  39.          HideSelection   =   0   'False
  40.          _Version        =   327682
  41.          ForeColor       =   -2147483640
  42.          BackColor       =   -2147483643
  43.          BorderStyle     =   1
  44.          Appearance      =   1
  45.          NumItems        =   1
  46.          BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  47.             Key             =   ""
  48.             Object.Tag             =   ""
  49.             Text            =   "Description"
  50.             Object.Width           =   2540
  51.          EndProperty
  52.       End
  53.       Begin VB.Label lblSort 
  54.          BackColor       =   &H8000000C&
  55.          Caption         =   "Sort by Version: 5"
  56.          BeginProperty Font 
  57.             Name            =   "Tahoma"
  58.             Size            =   8.25
  59.             Charset         =   0
  60.             Weight          =   700
  61.             Underline       =   0   'False
  62.             Italic          =   0   'False
  63.             Strikethrough   =   0   'False
  64.          EndProperty
  65.          ForeColor       =   &H8000000E&
  66.          Height          =   255
  67.          Left            =   0
  68.          TabIndex        =   8
  69.          Top             =   0
  70.          Width           =   2895
  71.       End
  72.    End
  73.    Begin VB.PictureBox picTabContainer 
  74.       Height          =   1815
  75.       Index           =   2
  76.       Left            =   600
  77.       ScaleHeight     =   1755
  78.       ScaleWidth      =   3555
  79.       TabIndex        =   4
  80.       Top             =   3120
  81.       Width           =   3615
  82.       Begin ComctlLib.ListView lvFindResults 
  83.          Height          =   975
  84.          Left            =   0
  85.          TabIndex        =   6
  86.          Top             =   360
  87.          Width           =   3135
  88.          _ExtentX        =   5530
  89.          _ExtentY        =   1720
  90.          View            =   3
  91.          LabelEdit       =   1
  92.          LabelWrap       =   -1  'True
  93.          HideSelection   =   0   'False
  94.          _Version        =   327682
  95.          ForeColor       =   -2147483640
  96.          BackColor       =   -2147483643
  97.          BorderStyle     =   1
  98.          Appearance      =   1
  99.          NumItems        =   1
  100.          BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  101.             Key             =   ""
  102.             Object.Tag             =   ""
  103.             Text            =   "Description"
  104.             Object.Width           =   2540
  105.          EndProperty
  106.       End
  107.       Begin VB.Label lblFindResults 
  108.          BackColor       =   &H8000000C&
  109.          Caption         =   "Find Results:"
  110.          BeginProperty Font 
  111.             Name            =   "Tahoma"
  112.             Size            =   8.25
  113.             Charset         =   0
  114.             Weight          =   700
  115.             Underline       =   0   'False
  116.             Italic          =   0   'False
  117.             Strikethrough   =   0   'False
  118.          EndProperty
  119.          ForeColor       =   &H8000000E&
  120.          Height          =   255
  121.          Left            =   0
  122.          TabIndex        =   5
  123.          Top             =   0
  124.          Width           =   3135
  125.       End
  126.    End
  127.    Begin VB.PictureBox picTabContainer 
  128.       Height          =   1695
  129.       Index           =   1
  130.       Left            =   120
  131.       ScaleHeight     =   1635
  132.       ScaleWidth      =   3195
  133.       TabIndex        =   1
  134.       Top             =   2640
  135.       Width           =   3255
  136.       Begin ComctlLib.ListView lvFavourites 
  137.          Height          =   1095
  138.          Left            =   0
  139.          TabIndex        =   3
  140.          Top             =   360
  141.          Width           =   3015
  142.          _ExtentX        =   5318
  143.          _ExtentY        =   1931
  144.          View            =   3
  145.          LabelEdit       =   1
  146.          LabelWrap       =   -1  'True
  147.          HideSelection   =   0   'False
  148.          _Version        =   327682
  149.          ForeColor       =   -2147483640
  150.          BackColor       =   -2147483643
  151.          BorderStyle     =   1
  152.          Appearance      =   1
  153.          NumItems        =   2
  154.          BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  155.             Key             =   ""
  156.             Object.Tag             =   ""
  157.             Text            =   "Description"
  158.             Object.Width           =   2540
  159.          EndProperty
  160.          BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  161.             SubItemIndex    =   1
  162.             Key             =   ""
  163.             Object.Tag             =   ""
  164.             Text            =   "Section"
  165.             Object.Width           =   2540
  166.          EndProperty
  167.       End
  168.       Begin VB.Label lblFavourites 
  169.          BackColor       =   &H8000000C&
  170.          Caption         =   "Favourites:"
  171.          BeginProperty Font 
  172.             Name            =   "Tahoma"
  173.             Size            =   8.25
  174.             Charset         =   0
  175.             Weight          =   700
  176.             Underline       =   0   'False
  177.             Italic          =   0   'False
  178.             Strikethrough   =   0   'False
  179.          EndProperty
  180.          ForeColor       =   &H8000000E&
  181.          Height          =   255
  182.          Left            =   0
  183.          TabIndex        =   2
  184.          Top             =   0
  185.          Width           =   3015
  186.       End
  187.    End
  188.    Begin ComctlLib.TabStrip tbsTab 
  189.       Height          =   2415
  190.       Left            =   0
  191.       TabIndex        =   0
  192.       Top             =   0
  193.       Width           =   3135
  194.       _ExtentX        =   5530
  195.       _ExtentY        =   4260
  196.       ImageList       =   "ImageList1"
  197.       _Version        =   327682
  198.       BeginProperty Tabs {0713E432-850A-101B-AFC0-4210102A8DA7} 
  199.          NumTabs         =   3
  200.          BeginProperty Tab1 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  201.             Caption         =   "Favourites"
  202.             Key             =   ""
  203.             Object.Tag             =   ""
  204.             Object.ToolTipText     =   "Favourites"
  205.             ImageVarType    =   8
  206.             ImageKey        =   "FAVS"
  207.          EndProperty
  208.          BeginProperty Tab2 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  209.             Caption         =   "Find Results"
  210.             Key             =   ""
  211.             Object.Tag             =   ""
  212.             Object.ToolTipText     =   "Find Results"
  213.             ImageVarType    =   8
  214.             ImageKey        =   "FIND"
  215.          EndProperty
  216.          BeginProperty Tab3 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  217.             Caption         =   "Sort"
  218.             Key             =   ""
  219.             Object.Tag             =   ""
  220.             Object.ToolTipText     =   "Sort"
  221.             ImageVarType    =   8
  222.             ImageKey        =   "SORT"
  223.          EndProperty
  224.       EndProperty
  225.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  226.          Name            =   "Tahoma"
  227.          Size            =   8.25
  228.          Charset         =   0
  229.          Weight          =   400
  230.          Underline       =   0   'False
  231.          Italic          =   0   'False
  232.          Strikethrough   =   0   'False
  233.       EndProperty
  234.    End
  235.    Begin ComctlLib.ImageList ImageList1 
  236.       Left            =   3720
  237.       Top             =   1560
  238.       _ExtentX        =   1005
  239.       _ExtentY        =   1005
  240.       BackColor       =   -2147483637
  241.       ImageWidth      =   16
  242.       ImageHeight     =   16
  243.       MaskColor       =   12632256
  244.       UseMaskColor    =   0   'False
  245.       _Version        =   327682
  246.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  247.          NumListImages   =   3
  248.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  249.             Picture         =   "ctlBookmark.ctx":0000
  250.             Key             =   "FIND"
  251.          EndProperty
  252.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  253.             Picture         =   "ctlBookmark.ctx":031A
  254.             Key             =   "FAVS"
  255.          EndProperty
  256.          BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  257.             Picture         =   "ctlBookmark.ctx":2ACE
  258.             Key             =   "SORT"
  259.          EndProperty
  260.       EndProperty
  261.    End
  262. End
  263. Attribute VB_Name = "ctlFavourites"
  264. Attribute VB_GlobalNameSpace = False
  265. Attribute VB_Creatable = True
  266. Attribute VB_PredeclaredId = False
  267. Attribute VB_Exposed = False
  268. '----------------------------------------
  269. '- Name: Sam Huggill
  270. '- Email: sam@vbsquare.com
  271. '- Web: http://www.vbsquare.com/
  272. '- Company: Lighthouse Internet Solutions
  273. '- Date/Time: 14/08/99 11:28:38
  274. '----------------------------------------
  275. '- Notes:   Handles bookmarks, find results
  276. '           and sorting
  277. '----------------------------------------
  278.  
  279. Option Explicit
  280.  
  281. Private Const NumberOfTabs = 3
  282.  
  283. Private WithEvents m_cMenu As cPopupMenu
  284. Attribute m_cMenu.VB_VarHelpID = -1
  285.  
  286.  
  287. Private Sub lvFavourites_ColumnClick(ByVal ColumnHeader As ComctlLib.ColumnHeader)
  288.     '// Sort the items
  289.     lvFavourites.SortKey = ColumnHeader.Index - 1
  290.     lvFavourites.Sorted = True
  291. End Sub
  292.  
  293. Private Sub lvFavourites_ItemClick(ByVal Item As ComctlLib.ListItem)
  294.     Dim strKey As String
  295.     Dim nodNode As Node
  296.  
  297.     On Error Resume Next
  298.  
  299.     strKey = Item.Key
  300.  
  301.     If frmMain.tvwItems.Nodes(strKey) Is Nothing Then Exit Sub
  302.  
  303.     Set nodNode = frmMain.tvwItems.Nodes(strKey)
  304.     If Not (nodNode Is Nothing) Then
  305.         nodNode.EnsureVisible
  306.         nodNode.Selected = True
  307.         modData.SelectItem nodNode.Key, frmMain.ctlData1
  308.     End If
  309.  
  310.     Set nodNode = Nothing
  311. End Sub
  312.  
  313. Private Sub lvFavourites_KeyUp(KeyCode As Integer, Shift As Integer)
  314.     Dim lngRet As Long
  315.  
  316.     If KeyCode = vbKeyDelete Then
  317.         lngRet = MsgBox("Are you sure you want to delete this favourite?", vbExclamation + vbYesNo)
  318.         If lngRet = vbYes Then
  319.             modData.DeleteFavourite lvFavourites, lvFavourites.SelectedItem.Key
  320.         End If
  321.     End If
  322. End Sub
  323.  
  324. Private Sub lvFavourites_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  325.     Dim intIndex As Integer
  326.     Dim blnSelected As Boolean
  327.  
  328.     If lvFavourites.SelectedItem Is Nothing Then
  329.         blnSelected = False
  330.     Else
  331.         blnSelected = True
  332.     End If
  333.  
  334.     If Button = vbRightButton Then
  335.         m_cMenu.Restore "Favourites"
  336.         m_cMenu.Enabled(m_cMenu.IndexForKey("DELETE")) = blnSelected
  337.         intIndex = m_cMenu.ShowPopupMenu(X + lvFavourites.left, Y + lvFavourites.tOp)
  338.     End If
  339. End Sub
  340.  
  341. Private Sub lvFindResults_ItemClick(ByVal Item As ComctlLib.ListItem)
  342.     Dim strKey As String
  343.     Dim nodNode As Node
  344.  
  345.     strKey = Item.Key
  346.  
  347.     Set nodNode = frmMain.tvwItems.Nodes(strKey)
  348.     If Not (nodNode Is Nothing) Then
  349.         nodNode.EnsureVisible
  350.         nodNode.Selected = True
  351.         modData.SelectItem strKey, frmMain.ctlData1
  352.     End If
  353.  
  354.     Set nodNode = Nothing
  355. End Sub
  356.  
  357. Private Sub lvSort_ItemClick(ByVal Item As ComctlLib.ListItem)
  358.     Dim strKey As String
  359.     Dim nodNode As Node
  360.  
  361.     strKey = Item.Key
  362.  
  363.     Set nodNode = frmMain.tvwItems.Nodes(strKey)
  364.     If Not (nodNode Is Nothing) Then
  365.         nodNode.EnsureVisible
  366.         nodNode.Selected = True
  367.         modData.SelectItem strKey, frmMain.ctlData1
  368.     End If
  369.  
  370.     Set nodNode = Nothing
  371. End Sub
  372.  
  373. Private Sub lvSort_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  374.     Dim intIndex As Integer
  375.  
  376.     If Button = vbRightButton Then
  377.         m_cMenu.Restore "Sort"
  378.         m_cMenu.RemoveItem "DELETE"
  379.         intIndex = m_cMenu.ShowPopupMenu(X + lvSort.left, Y + lvSort.tOp)
  380.     End If
  381. End Sub
  382.  
  383. Private Sub m_cMenu_Click(ItemNumber As Long)
  384.     Select Case m_cMenu.ItemKey(ItemNumber)
  385.  
  386.         Case "DELETE"
  387.             lvFavourites_KeyUp vbKeyDelete, 0
  388.         Case "Version"
  389.             frmSort.Caption = "Sort by Version"
  390.  
  391.             With frmSort.cboData
  392.                 .Clear
  393.                 .AddItem "VB4 16"
  394.                 .AddItem "VB4 32"
  395.                 .AddItem "VB5"
  396.                 .AddItem "VB6"
  397.                 .ListIndex = 0
  398.             End With
  399.  
  400.             frmSort.Show vbModal
  401.         Case "Level"
  402.             frmSort.Caption = "Sort by Level"
  403.  
  404.             With frmSort.cboData
  405.                 .Clear
  406.                 .AddItem "Beginner"
  407.                 .AddItem "Intermediate"
  408.                 .AddItem "Advanced"
  409.                 .ListIndex = 0
  410.             End With
  411.  
  412.             frmSort.Show vbModal
  413.         Case Else
  414.     End Select
  415. End Sub
  416.  
  417. Private Sub tbsTab_Click()
  418.     Static PrevTab As Integer
  419.  
  420.     PrevTab = Switch(PrevTab = 0, 1, PrevTab >= 1 And PrevTab <= NumberOfTabs, PrevTab)
  421.  
  422.     picTabContainer(PrevTab).Visible = False
  423.     picTabContainer(tbsTab.SelectedItem.Index).Visible = True
  424.     picTabContainer(tbsTab.SelectedItem.Index).Refresh
  425.     PrevTab = tbsTab.SelectedItem.Index
  426.     DoEvents
  427.  
  428. End Sub
  429.  
  430. Private Sub UserControl_Resize()
  431.     With tbsTab
  432.         .Move UserControl.ScaleLeft, UserControl.ScaleTop, UserControl.ScaleWidth, UserControl.ScaleHeight
  433.     End With
  434.  
  435.     With picTabContainer(1)
  436.         .tOp = tbsTab.ClientTop
  437.         .Width = tbsTab.ClientWidth
  438.         .left = tbsTab.ClientLeft
  439.         .Height = tbsTab.ClientHeight
  440.         .Move .left, .tOp, .Width, .Height
  441.     End With
  442.  
  443.     With picTabContainer(2)
  444.         .tOp = tbsTab.ClientTop
  445.         .Width = tbsTab.ClientWidth
  446.         .left = tbsTab.ClientLeft
  447.         .Height = tbsTab.ClientHeight
  448.         .Move .left, .tOp, .Width, .Height
  449.     End With
  450.  
  451.     With picTabContainer(3)
  452.         .tOp = tbsTab.ClientTop
  453.         .Width = tbsTab.ClientWidth
  454.         .left = tbsTab.ClientLeft
  455.         .Height = tbsTab.ClientHeight
  456.         .Move .left, .tOp, .Width, .Height
  457.     End With
  458.  
  459.     With lblFavourites
  460.         .Move ScaleLeft + 15, ScaleTop + 15, tbsTab.ClientWidth - 30, .Height
  461.     End With
  462.  
  463.     With tbsTab
  464.         lvFavourites.Move ScaleLeft + 15, lblFavourites.Height + 15, .ClientWidth - lvFavourites.left, .ClientHeight - lblFavourites.Height
  465.         lvFindResults.Move ScaleLeft + 15, lblFindResults.Height + 15, .ClientWidth - lvFindResults.left, .ClientHeight - lblFindResults.Height
  466.         lvSort.Move ScaleLeft + 15, lblSort.Height + 15, .ClientWidth - lvSort.left, .ClientHeight - lblSort.Height
  467.     End With
  468.  
  469.     With lblFindResults
  470.         .Move ScaleLeft + 15, ScaleTop + 15, tbsTab.ClientWidth - 30, .Height
  471.     End With
  472.  
  473.     With lblFavourites
  474.         .Move ScaleLeft + 15, ScaleTop + 15, tbsTab.ClientWidth - 30, .Height
  475.     End With
  476.  
  477.     With lblSort
  478.         .Move ScaleLeft + 15, ScaleTop + 15, tbsTab.ClientWidth - 30, .Height
  479.     End With
  480.  
  481. End Sub
  482.  
  483. Public Sub AutoSizeLastColumn(lvListView As ListView)
  484.     Dim lCount As Long
  485.     Dim lNoColumns As Long
  486.     Dim lTotSize As Long
  487.     Dim lRet As Long
  488.     Dim lSize As Long
  489.     Dim lHScrollBarWidth As Long
  490.  
  491.     '
  492.     ' Get Number of columns in this listview
  493.     '
  494.     lNoColumns = lvListView.ColumnHeaders.Count
  495.     '
  496.     ' Get ScrollBar Width
  497.     '
  498.     lHScrollBarWidth = GetSystemMetrics(SM_CXVSCROLL)
  499.  
  500.     For lCount = 0 To lNoColumns - 2
  501.         '
  502.         ' Get the total size of all the columns except the last one we want to resize
  503.         '
  504.         lSize = SendMessageLong(lvListView.hwnd, LVM_GETCOLUMNWIDTH, lCount, 0)
  505.         lTotSize = lTotSize + lSize
  506.     Next
  507.     '
  508.     ' Now determine how big to make the last columm in pixels
  509.     '
  510.  
  511.     lSize = (lvListView.Width / Screen.TwipsPerPixelX) - (lTotSize + lHScrollBarWidth + 10)
  512.     '
  513.     ' Now set the column width
  514.     '
  515.     SendMessageLong lvListView.hwnd, LVM_SETCOLUMNWIDTH, lNoColumns - 1, lSize
  516.  
  517. End Sub
  518.  
  519. Sub Initalize()
  520.     Dim strSort As String
  521.     Dim strValue As String
  522.     Dim intX As Integer
  523.     Dim blnTab As Boolean
  524.     Dim intTabIndex As Integer
  525.  
  526.     On Error GoTo vbErrHand
  527.  
  528.     For intX = 1 To NumberOfTabs
  529.         With picTabContainer(intX)
  530.             .BorderStyle = 0
  531.             .left = tbsTab.ClientLeft
  532.             .tOp = tbsTab.ClientTop
  533.             .Width = tbsTab.ClientWidth
  534.             .Height = tbsTab.ClientHeight
  535.             .Visible = False
  536.         End With
  537.     Next intX
  538.  
  539.     modData.LoadBookmarks lvFavourites
  540.  
  541.     AutoSizeLastColumn lvFavourites
  542.     AutoSizeLastColumn lvFindResults
  543.     SetControl
  544.  
  545.     '// Setup the popup menu
  546.     Set m_cMenu = New cPopupMenu
  547.     With m_cMenu
  548.         .ImageList = frmMain.ilsMenu
  549.         .hwndOwner = UserControl.hwnd
  550.         .GradientHighlight = True
  551.         .Clear
  552.  
  553.         .AddItem "&Delete Favourite", , , , 14, , , "DELETE"
  554.         .Store "Favourites"
  555.  
  556.         .AddItem "Sort by &Version", , , , 26, , , "Version"
  557.         .AddItem "Sort by &Level", , , , 26, , , "Level"
  558.         .Store "Sort"
  559.     End With
  560.  
  561.     strSort = GetSetting(ThisApp, "General", "Sort Type", "Version")
  562.     strValue = GetSetting(ThisApp, "General", "Sort Value", "5")
  563.     lblSort = modData.SortBy(strSort, strValue, lvSort)
  564.  
  565.     blnTab = GetSetting(ThisApp, "General", "Remember Tabs", True)
  566.     If blnTab Then
  567.         intTabIndex = Val(GetSetting(ThisApp, "General", "Control Panel", 1))
  568.  
  569.         '// Thanks to Randy Ledyard
  570.         If intTabIndex = 0 Then intTabIndex = 1
  571.  
  572.         tbsTab.Tabs(intTabIndex).Selected = True
  573.     End If
  574.  
  575.     '    SetBkImage lvFavourites
  576.     '    SetBkImage lvFindResults
  577.     '    SetBkImage lvSort
  578.  
  579.     FlatHeader lvFavourites
  580.     FlatHeader lvFindResults
  581.     FlatHeader lvSort
  582.  
  583.     HeaderTrackSelect lvFavourites
  584.     HeaderTrackSelect lvFindResults
  585.     HeaderTrackSelect lvSort
  586.  
  587.     Exit Sub
  588.  
  589. vbErrHand:
  590.     WriteError Err.Number, Err.Description, "ctlFavs:Init", Now, App.Path & "\err.log"
  591.     MsgBox Err.Description, vbCritical + vbOKOnly, "ctlFavs:Init"
  592.  
  593.  
  594. End Sub
  595.  
  596. Sub SetControl()
  597.     Dim lStyle As Long
  598.     Dim lHeaderHWND As Long
  599.     Dim lLVHwnd As Long
  600.     Dim lCount As Long
  601.  
  602.     lLVHwnd = lvFavourites.hwnd
  603.     SendMessageLong lLVHwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, True
  604.  
  605.     lLVHwnd = lvFindResults.hwnd
  606.     SendMessageLong lLVHwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, True
  607.  
  608.     lLVHwnd = lvSort.hwnd
  609.     SendMessageLong lLVHwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, True
  610.  
  611.     '
  612.     ' Turn off Redrawing at this point to speed up / hide the visible changes
  613.     '
  614.  
  615.     SendMessageLong lvFavourites.hwnd, WM_SETREDRAW, False, &O0
  616.     SendMessageLong lvFindResults.hwnd, WM_SETREDRAW, False, &O0
  617.     SendMessageLong lvSort.hwnd, WM_SETREDRAW, False, &O0
  618.  
  619.     For lCount = 0 To lvFavourites.ColumnHeaders.Count - 1
  620.         Call SendMessageLong(lvFavourites.hwnd, LVM_SETCOLUMNWIDTH, lCount, ByVal LVSCW_AUTOSIZE_USEHEADER)
  621.     Next
  622.  
  623.     For lCount = 0 To lvFindResults.ColumnHeaders.Count - 1
  624.         Call SendMessageLong(lvFindResults.hwnd, LVM_SETCOLUMNWIDTH, lCount, ByVal LVSCW_AUTOSIZE_USEHEADER)
  625.     Next
  626.  
  627.     For lCount = 0 To lvSort.ColumnHeaders.Count - 1
  628.         Call SendMessageLong(lvSort.hwnd, LVM_SETCOLUMNWIDTH, lCount, ByVal LVSCW_AUTOSIZE_USEHEADER)
  629.     Next
  630.     '
  631.     ' Turn Redrawing back on
  632.     '
  633.     SendMessageLong lvFavourites.hwnd, WM_SETREDRAW, True, &O0
  634.     SendMessageLong lvFindResults.hwnd, WM_SETREDRAW, True, &O0
  635.     SendMessageLong lvSort.hwnd, WM_SETREDRAW, True, &O0
  636. End Sub
  637.  
  638. Sub SelectTab(intTab As Integer)
  639.     tbsTab.Tab = intTab
  640. End Sub
  641.  
  642. Sub Sort(frm As Object)
  643.     If frm.Caption = "Sort by Version" Then
  644.         lblSort = modData.SortBy("Version", Right$(frm.cboData.Text, Len(frm.cboData.Text) - 2), lvSort)
  645.     End If
  646.  
  647.     If frm.Caption = "Sort by Level" Then
  648.         lblSort = modData.SortBy("Level", frm.cboData.Text, lvSort)
  649.     End If
  650.  
  651. End Sub
  652.  
  653. Public Sub AddFindRes(strText As String, strKey As String)
  654.     lvFindResults.ListItems.Add , strKey, strText
  655.     SetControl
  656. End Sub
  657.  
  658. Public Sub AddItem(tvw As TreeView)
  659.     modData.Key = tvw.SelectedItem.Key
  660.     modData.AddFavourite tvw, lvFavourites
  661. End Sub
  662.  
  663. Public Sub Terminate()
  664.     If Not (m_cMenu Is Nothing) Then
  665.         m_cMenu.Clear
  666.         m_cMenu.DestroySubClass
  667.     End If
  668.  
  669.     Set m_cMenu = Nothing
  670.     modData.SaveSort lblSort, tbsTab.SelectedItem.Index, lvSort
  671. End Sub
  672.  
  673. Public Sub DeleteItem(tvw As TreeView)
  674.     modData.DeleteFavourite lvFavourites, tvw.SelectedItem.Key
  675. End Sub
  676.  
  677. Sub ClearFindRes()
  678.  
  679.     lvFindResults.ListItems.Clear
  680.  
  681. End Sub
  682.  
  683. Public Function ListCount() As Integer
  684.     ListCount = lvFindResults.ListItems.Count
  685. End Function
  686.  
  687. Public Sub ShowFindTab()
  688.     tbsTab.Tabs(2).Selected = True
  689. End Sub
  690.  
  691. Private Sub SetBkImage(lv As ListView)
  692.     Dim tLBI As LVBKIMAGE
  693.     Dim strPath As String
  694.     strPath = App.Path & "\back.gif"
  695.     tLBI.pszImage = strPath & Chr$(0)
  696.     tLBI.cchImageMax = Len(strPath) + 1
  697.     tLBI.ulFlags = LVBKIF_SOURCE_URL Or LVBKIF_STYLE_TILE
  698.     SendMessage lv.hwnd, LVM_SETBKIMAGE, 0, tLBI
  699.     SendMessageByLong lv.hwnd, LVM_SETTEXTBKCOLOR, 0, CLR_NONE
  700. End Sub
  701.  
  702. Private Sub FlatHeader(lv As ListView)
  703.     Dim lngHwnd As Long
  704.     Dim lngStyle As Long
  705.  
  706.     lngHwnd = SendMessageByLong(lv.hwnd, LVM_GETHEADER, 0, 0)
  707.     If lngHwnd <> 0 Then
  708.         lngStyle = GetWindowLong(lngHwnd, GWL_STYLE)
  709.         lngStyle = lngStyle And Not HDS_BUTTONS
  710.         SetWindowLong lngHwnd, GWL_STYLE, lngStyle
  711.     End If
  712. End Sub
  713.  
  714. Private Sub HeaderTrackSelect(lv As ListView)
  715.     Dim lngHwnd As Long
  716.     Dim lngStyle As Long
  717.  
  718.     lngHwnd = SendMessageByLong(lv.hwnd, LVM_GETHEADER, 0, 0)
  719.     If lngHwnd <> 0 Then
  720.         lngStyle = GetWindowLong(lngHwnd, GWL_STYLE)
  721.         lngStyle = lngStyle Or HDS_HOTTRACK
  722.         SetWindowLong lngHwnd, GWL_STYLE, lngStyle
  723.     End If
  724. End Sub
  725.